package Controller;


import javafx.scene.control.Alert;
import javafx.scene.control.ButtonBar;
import javafx.scene.control.ButtonType;
import javafx.scene.web.WebEngine;
import javafx.stage.Window;

import javax.lang.model.element.VariableElement;
import java.util.Optional;

/**
 * @program: StudentMS
 * @description: some tools
 * @author: XuYuanjun
 * @create: 2020-03-07 18:46
 **/
public class Utils {

    public static Utils Inst = new Utils();

    public void  setErrorMsg(Alert.AlertType alertType,String contenText,String title,String headerText){
        Alert alert = new Alert(alertType,contenText);
        alert.setTitle(title);
        alert.setHeaderText(headerText);
        Optional<ButtonType> buttonType = alert.showAndWait();
    }

    public void setErrorMsg(Alert.AlertType alertType, String contentText) {
        Alert alert = new Alert(alertType, contentText);
        Optional<ButtonType> buttonType = alert.showAndWait();
    }

    public Optional<ButtonType> setToolTipMsg(Alert.AlertType alertType,String contenText,String title,String headerText){
        Alert alert = new Alert(alertType,contenText);
        alert.setTitle(title);
        alert.setHeaderText(headerText);
        return alert.showAndWait();
    }

    public Optional<ButtonType> setToolTipMsg(Alert.AlertType alertType,String contenText){
        Alert alert = new Alert(alertType,contenText);
        //alert.initOwner(null); // 指定 owner
        return alert.showAndWait();
    }
}
